#ifndef __CMD_H__
#define __CMD_H__


#include <unordered_map>
#include <string>
#include <vector>

namespace cmd{
    const int CLIENT_LOGIN = 1;
    const int CLIENT_LOGOUT = 2;
    const int CLIENT_REGIST = 3;
    const int CLIENT_GET_PLAYER_INFO = 4;
    const int CLIENT_ENTER_DEFAULT_SCENE = 5;
    const int CLIENT_MOVE = 6;
    const int CLIENT_USE_SKILL = 7;

    const int SERVER_COMMON_RESPONSE = 1;
    const int SERVER_LOGIN_RESPONSE = 2;
    const int SERVER_PLAYER_INFO_RESPONSE = 3;
    const int SERVER_REGIST_RESPONSE = 4;
    const int SERVER_ENTER_DEFAULT_SCENE_RESPONSE = 5;
    const int SERVER_MOVE_RESPONSE = 6;
    const int SERVER_USE_SKILL_RESPONSE = 7;
    


    
    // const int CLIENT_REGISTER = 4;
    // const int SERVER_REGISTER = 5;

    // const int CLIENT_WORK = 6;
    // const int SERVER_WORK = 7;

    // const int CLIENT_ENTER = 8;
    // const int SERVER_ENTER = 9;

    // const int CLIENT_LEAVE = 10;
    // const int SERVER_LEAVE = 11;

    // const int SERVER_LOGOUT = 13;

    // const int CLIENT_EXIT = 14;

    // const int CLIENT_MOVE = 15;
    // const int SERVER_MOVE = 16;
    // const int CLIENT_STOP_MOVE = 17;


    inline std::unordered_map<int, std::string> cmd2pb = {
        {SERVER_COMMON_RESPONSE, "service.common.CommonResponse"},
        {CLIENT_LOGIN, "service.account.LoginRequest"},
        {SERVER_LOGIN_RESPONSE, "service.account.LoginRequest.Response"},
        {CLIENT_REGIST, "service.account.RegisterRequest"},
        {SERVER_REGIST_RESPONSE, "service.account.RegisterRequest.Response"},
        {CLIENT_GET_PLAYER_INFO, "service.player.GetPlayerBaseInfoRequest"},
        {SERVER_PLAYER_INFO_RESPONSE, "service.player.GetPlayerBaseInfoRequest.Response"},
        {CLIENT_ENTER_DEFAULT_SCENE, "service.scene.RequestEnterDefaultScene"},
        {SERVER_ENTER_DEFAULT_SCENE_RESPONSE, "service.scene.RequestEnterDefaultScene.Response"},
        {CLIENT_MOVE, "service.scene.RequestMove"},
        {SERVER_MOVE_RESPONSE, "service.scene.RequestMove.Response"},
        {CLIENT_USE_SKILL, "service.scene.RequestUseSkill"},
        {SERVER_USE_SKILL_RESPONSE, "service.scene.RequestUseSkill.Response"},


        // {CLIENT_WORK, "scene.Work"},
        // {SERVER_WORK, "scene.WorkRet"},
        // {CLIENT_ENTER, "scene.EnterScene"},
        // {SERVER_ENTER, "scene.EnterSceneRet"},
        // {CLIENT_LEAVE, "scene.LeaveScene"},
        // {SERVER_LEAVE, "scene.LeaveSceneRet"},

        // {CLIENT_LOGOUT, "login.Logout"},
        // {SERVER_LOGOUT, "login.LogoutRet"},
        // {CLIENT_EXIT, "login.Exit"},

        // {CLIENT_MOVE, "login.StartMove"},
        // {SERVER_MOVE, "login.MoveRet"},
        // {CLIENT_STOP_MOVE, "login.StopMove"},

    };

    inline std::vector<std::string> cmd_id_desc = {
        "登录：" + std::to_string(CLIENT_LOGIN),
        "注册：" + std::to_string(CLIENT_REGIST),
        "获取玩家基本信息: " + std::to_string(CLIENT_GET_PLAYER_INFO),
        "请求进入默认场景: " + std::to_string(CLIENT_ENTER_DEFAULT_SCENE),
        "请求移动:" + std::to_string(CLIENT_MOVE),
        "使用技能:" + std::to_string(CLIENT_USE_SKILL),

        // "工作：" + std::to_string(CLIENT_WORK),
        // "请求进入场景：" + std::to_string(CLIENT_ENTER),
        // "请求退出场景：" + std::to_string(CLIENT_LEAVE),
        // "退出登录：" + std::to_string(CLIENT_LOGOUT),
        // "开始移动：" + std::to_string(CLIENT_MOVE),
        // "停止移动：" + std::to_string(CLIENT_STOP_MOVE),
    };

    inline std::string GetPbType(int cmd){
        auto it = cmd2pb.find(cmd);
        if(it != cmd2pb.end()){
            return it->second;
        }else{
            return "";
        }
    }
}

#endif  // __CMD_H__